﻿#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);

    //栈控件使用
    //设置默认定位 scroll area
    ui->stackedWidget->setCurrentIndex(0);
    //scroll area 按钮
    connect(ui->btn_scroll,&QPushButton::clicked,[=](){
       ui->stackedWidget->setCurrentIndex(0);
    });
    //toolbox按钮
    connect(ui->btn_toolbox,&QPushButton::clicked,[=] (){
        ui->stackedWidget->setCurrentIndex(1);
    });

    //下拉框
    ui->comboBox->addItem(QStringLiteral("奔驰"));
    ui->comboBox->addItem(QStringLiteral("宝马"));
    ui->comboBox->addItem(QStringLiteral("夏利"));

    //点击按钮 选中宝马
    connect(ui->btn_select,&QPushButton::clicked,[=](){
        ui->comboBox->setCurrentIndex(1);

    });
}

Widget::~Widget()
{
    delete ui;
}
